<?php
// Inialize session
session_start ();

// Check, if username session is NOT set then this page will jump to login page
if (! isset ( $_SESSION ['username'] )) {
	header ( 'Location: index.php' );
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
// for PHP debugging - delete before turning over to clients
ob_start ();
require_once ('FirePHPCore/FirePHP.class.php');
?>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Add Data</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<script src="calenderPopup.js">
	</script>
<script>
		var cal = new CalendarPopup();
	</script>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="jquery.js"></script>
<script type='text/javascript'
	src="DataTables-1.7.3/media/js/jquery.dataTables.min.js"></script>
<style type="text/css">
@import "DataTables-1.7.3/media/css/demo_table.css";
</style> 
	<?php
	include_once 'functions.php';
	include_once 'additionalFunctions.php';
	include 'insert_functions.php';
	?>
</head>

<body>
	<?php
	include 'headinfo.php';
	?>
	<hr />
<div id="header">
		<?php
		$thispage = "Add Crop Data";
		require 'menu.php';
		?>
		
		<!-- end #menu --></div>
<!-- end #header -->
<!-- end #header-wrapper -->
<div id="page">

<div id="content">

<div class="post">

<h2 class="title"><a href="#">Add Crop Data</a></h2>


<p class="meta"></p>
				<?php
				$thissubpage = "Crop Info";
				require 'menu_addCropData.php';
				?>
					
    						<form method="post" action="insert_cropinfo_process.php">
<table class="tablecss" width="600" border="1">
	<tr height=50>
		<th colspan="5" scope="row">
		<h2>Crop Info</h2>
		</th>
	</tr>
	<tr>
		<th colspan="5" scope="row" align="center"><select name="cropName"
			id="cropName">
			<?php
			if (isset ( $_GET ['cropName'] )) {
				echo "<option value='" . $_GET ['cropName'] . "'>" . $_GET ['cropName'] . "</option>";
			} else {
				echo "<option value=''>- Select Crop Name -</option>";
			}
			$allCrops = getAllCrops ();
			for($i = 0; $i < count ( $allCrops ); $i ++) {
				echo "<option value=\"" . $allCrops [$i] ['cropname'] . "\">" . $allCrops [$i] ['cropname'] . "</option>";
			}
			?>
		</select></th>
	</tr>
	<tr>
		<th>Seeds Bought</th>
		<td colspan="2" align="center"><input name="cropNum1"
			value="<?php
			if (isset ( $_GET ['cropNum1'] )) {
				echo $_GET ['cropNum1'];
			} else {
				echo 0;
			}
			?>" /></td>
		<td colspan="2" align="center">

		<div id="insertData">Date: <input id="date1" type="text" name="date1"
			size="15"
			value="<?php
			if (isset ( $_GET ['date1'] )) {
				echo $_GET ['date1'];
			} else {
				date_default_timezone_set ( 'EST' );
				echo date ( "Y-m-d" );
			}
			?>" /> <a href="#" id="anchor1" name="anchor1"
			onclick="cal.select(document.getElementById('date1'), 'anchor1', 'yyyy-MM-dd'); return false;">Calendar</a>
		<br />
		</div>
		</td>
	</tr>
	<tr>
		<th scope="row">Planted</th>
		<td colspan="2" align="center"><input name="cropNum2"
			value="<?php
			if (isset ( $_GET ['cropNum2'] )) {
				echo $_GET ['cropNum2'];
			} else {
				echo 0;
			}
			?>" /></td>
		<td colspan="2" align="center">
		<div id="insertData">Date: <input id="date2" type="text" name="date2"
			size="15"
			value="<?php
			if (isset ( $_GET ['date2'] )) {
				echo $_GET ['date2'];
			} else {
				date_default_timezone_set ( 'EST' );
				echo date ( "Y-m-d" );
			}
			?>" /> <a href="#" id="anchor2" name="anchor2"
			onclick="cal.select(document.getElementById('date2'), 'anchor2', 'yyyy-MM-dd'); return false;">Calendar</a>
		<br />
		</div>
		</td>
	</tr>
	<tr>
		<th scope="row">Transplanted</th>
		<td colspan="2" align="center"><input name="cropNum3"
			value="<?php
			if (isset ( $_GET ['cropNum3'] )) {
				echo $_GET ['cropNum3'];
			} else {
				echo 0;
			}
			?>" /></td>
		<td colspan="2" align="center">
		<div id="insertData">Date: <input id="date3" type="text" name="date3"
			size="15"
			value="<?php
			if (isset ( $_GET ['date3'] )) {
				echo $_GET ['date3'];
			} else {
				date_default_timezone_set ( 'EST' );
				echo date ( "Y-m-d" );
			}
			?>" /> <a href="#" id="anchor3" name="anchor3"
			onclick="cal.select(document.getElementById('date3'), 'anchor3', 'yyyy-MM-dd'); return false;">Calendar</a>
		<br />
		</div>
		</td>
	</tr>
	<tr>
		<th colspan="5" scope="row" align="center"><input type="submit"
			name="submitCropInfo" value="submit!" /></th>
	</tr>
</table>
</form>
</div>
</div>
</div>

<div style="clear: both;">&nbsp;</div>

<div id="footer">
<p>Copyright (c) 2010 Dilmun Hill Team.</p>
</div>

</body>

</html>